/* ----------------------------------------------------------------------
*
* Copyright (C) 2024 XiaoFei. All rights reserved.
*
* @file:        XiaoFei_BasicMath.c
* @author:      XiaoFei
* @Date:        03-October-2024
* @Revision:    V1
* @Project:     XiaoFei DSP Library
*
* -------------------------------------------------------------------- */

#include "XiaoFei_BasicMath.h"

/* 
* @function: 	My_LagrangeSin
* @parameter:   [in]    *input          A pointer to the argument of a Sinusoidal function.
* @parameter:   [in]    order           The order of the function approximation.
*                                       This parameter can be any integer from 4 to 8.
* @parameter:   [out]   *output         The result of the calculation based on Lagrangian interpolation.
* @return:      Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_LagrangeSin(double* input, unsigned int order, double* output)
{
    double x;
    x = *input;
    switch(order)
    {
        case 8:
            *output = x*(0.9988-x*x*(0.1649-x*x*(0.0077-x*x*0.00012975)));
            return Success;
        case 7:
            *output = x*(0.9997-x*x*(0.1657-x*x*(0.0079-x*x*0.00013498)));
            return Success;
        case 6:
            *output = x*(0.9716-x*x*(0.1445-x*x*0.0045));
            return Success;
        case 5:
            *output = x*(0.9914-x*x*(0.1511-x*x*0.0048));
            return Success;
        case 4:
            *output = x*(0.6693-x*x*0.0537);
            return Success;
        default:
            return Error;
    }
}

/* 
* @function:    My_LagrangeCos
* @parameter:   [in]    *input          A pointer to the argument of a Cosine function.
* @parameter:   [in]    order           The order of the function approximation.
*                                       This parameter can be any integer from 4 to 8.
* @parameter:   [out]   *output         The result of the calculation based on Lagrangian interpolation.
* @return:      Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_LagrangeCos(double* input, unsigned int order, double* output)
{
    double x;
    x = *input;
    switch(order)
    {
        case 8:
            *output = 1-x*x*(0.4999-x*x*(0.0415-x*x*(0.0013-x*x*0.000017721)));
            return Success;
        case 7:
            *output = 0.9977-x*x*(0.4918-x*x*(0.0377-x*x*0.00083974));
            return Success;
        case 6:
            *output = 1-x*x*(0.4962-x*x*(0.0387-x*x*0.00088451));
            return Success;
        case 5:
            *output = 0.9452-x*x*(0.4002-x*x*0.0188);
            return Success;
        case 4:
            *output = 1-x*x*(0.4376-x*x*0.0209);
            return Success;
        default:
            return Error;
    }
}

/* 
* @function: 	My_LagrangeTan
* @parameter:	[in] 	*input			A pointer to the argument of a Tangent function.
* @parameter:	[in] 	order			The order of the function approximation.
*							            This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on Lagrangian interpolation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_LagrangeTan(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = x*(0.8423+x*x*(1.8656-x*x*(3.0246-x*x*1.7271)));
			return Success;
		case 7:
			*output = x*(0.9722+x*x*(1.0325-x*x*(1.9479-x*x*1.4017)));
			return Success;
		case 6:
			*output = x*(1.6446-x*x*(2.9147-x*x*2.8275));
			return Success;
		case 5:
			*output = x*(1.1552-x*x*(1.5889-x*x*2.3350));
			return Success;
		case 4:
			*output = -x*(1.4775-x*x*4.8349);
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_LagrangeSec
* @parameter:	[in] 	*input			A pointer to the argument of a Secant function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on Lagrangian interpolation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_LagrangeSec(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = 1+x*x*(0.3996+x*x*(1.1838-x*x*(1.9257-x*x*1.0995)));
			return Success;
		case 7:
			*output = 0.9563+x*x*(1.5982-x*x*(3.0608-x*x*2.2018));
			return Success;
		case 6:
			*output = 1+x*x*(0.9103-x*x*(1.8594-x*x*1.7999));
			return Success;
		case 5:
			*output = 1.2438-x*x*(2.5193-x*x*3.6665);
			return Success;
		case 4:
			*output = 1-x*x*(1.0770-x*x*3.0736);
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_LagrangeCsc
* @parameter:	[in] 	*input			A pointer to the argument of a Cosecant function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on Lagrangian interpolation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_LagrangeCsc(double* input, unsigned int order, double* output)
{
	double x;
	x = *input-My_PI/2;
	switch(order){
		case 8:
			*output = 1+x*x*(0.3996+x*x*(1.1838-x*x*(1.9257-x*x*1.0995)));
			return Success;
		case 7:
			*output = 0.9563+x*x*(1.5982-x*x*(3.0608-x*x*2.2018));
			return Success;
		case 6:
			*output = 1+x*x*(0.9103-x*x*(1.8594-x*x*1.7999));
			return Success;
		case 5:
			*output = 1.2438-x*x*(2.5193-x*x*3.6665);
			return Success;
		case 4:
			*output = 1-x*x*(1.0770-x*x*3.0736);
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_LagrangeCot
* @parameter:	[in] 	*input			A pointer to the argument of a Cotangent function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on Lagrangian interpolation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_LagrangeCot(double* input, unsigned int order, double* output)
{
	double x;
	x = *input-My_PI/2;
	switch(order){
		case 8:
			*output = -x*(0.8423+x*x*(1.8656-x*x*(3.0246-x*x*1.7271)));
			return Success;
		case 7:
			*output = -x*(0.9722+x*x*(1.0325-x*x*(1.9479-x*x*1.4017)));
			return Success;
		case 6:
			*output = -x*(1.6446-x*x*(2.9147-x*x*2.8275));
			return Success;
		case 5:
			*output = -x*(1.1552-x*x*(1.5889-x*x*2.3350));
			return Success;
		case 4:
			*output = x*(1.4775-x*x*4.8349);
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_LagrangeExp
* @parameter:	[in] 	*input			A pointer to the argument of a Exponential functions.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on Lagrangian interpolation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_LagrangeExp(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = 1+x*(1+x*(0.5+x*(0.1667+x*(0.0417+x*(0.0083+x*(0.0014+x*(0.00022009+x*0.000026952)))))));
			return Success;
		case 7:
			*output = 1+x*(1+x*(0.5002+x*(0.1667+x*(0.0413+x*(0.0083+x*(0.0016+x*0.00021818))))));
			return Success;
		case 6:
			*output = 1+x*(1.0007+x*(0.5001+x*(0.1646+x*(0.0414+x*(0.0097+x*0.0016)))));
			return Success;
		case 5:
			*output = 1.0014+x*(1.0002+x*(0.4898+x*(0.1652+x*(0.0501+x*0.0095))));
			return Success;
		case 4:
			*output = 1+x*(0.9625+x*(0.4939+x*(0.2127+x*0.0492)));
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_LagrangeLog
* @parameter:	[in] 	*input			A pointer to the argument of a Logarithmic functions.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on Lagrangian interpolation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_LagrangeLog(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = -2.6728+x*(7.5375-x*(12.088-x*(14.392-x*(11.759-x*(6.4111-x*(2.2274-x*(0.44573-x*0.039084)))))));
			return Success;
		case 7:
			*output = -2.5527+x*(6.6096-x*(9.0612-x*(8.929-x*(5.7761-x*(2.3303-x*(0.53111-x*0.052171))))));
			return Success;
		case 6:
			*output = -2.4163+x*(5.6803-x*(6.463-x*(5.0461-x*(2.4135-x*(0.63742-x*0.071092)))));
			return Success;
		case 5:
			*output = -2.2586+x*(4.749-x*(4.2943-x*(2.4788-x*(0.77423-x*0.099643))));
			return Success;
		case 4:
			*output = -2.072+x*(3.8141-x*(2.557-x*(0.9616-x*0.14548)));
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_LagrangeArctan
* @parameter:	[in] 	*input			A pointer to the argument of a Arctangent function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on Lagrangian interpolation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_LagrangeArctan(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = -x*(x*(x*(x*(x*(x*(x*(0.004579*x-0.03567)+0.09829)-0.0676)-0.2083)+0.4508)-0.03052)-0.997);
			return Success;
		case 7:
			*output = -x*(x*(x*(x*(x*(x*(0.001659*x-0.02697)+0.1555)-0.4345)+0.5801)-0.06862)-0.9927);
			return Success;
		case 6:
			*output = x*(x*(x*(x*(x*(0.01609*x-0.1278)+0.34)-0.5587)+0.0627)+0.9931);
			return Success;
		case 5:
			*output = -x*(x*(x*(x*(0.03103*x-0.1801)+0.3254)+0.05103)-1.013);
			return Success;
		case 4:
			*output = x*(x*(x*(0.02251*x-0.04416)-0.257)+1.064);
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_LagrangeSqrt
* @parameter:	[in] 	*input			A pointer to the argument of a Square root.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on Lagrangian interpolation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_LagrangeSqrt(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = 0.07246 - x*(x*(x*(x*(x*(x*(x*(0.1659*x - 1.5238) + 5.9278) - 12.7419) + 16.5698) - 13.4677) + 6.9649) - 2.8225);
			return Success;
		case 7:
			*output = x*(x*(x*(x*(x*(x*(0.1525*x - 1.2491) + 4.2383) - 7.72497) + 8.2349) - 5.3432) + 2.6175) + 0.07435;
			return Success;
		case 6:
			*output = 0.07645 - x*(x*(x*(x*(x*(0.1443*x - 1.0409) + 3.0211) - 4.5498) + 3.8953) - 2.3935);
			return Success;
		case 5:
			*output = x*(x*(x*(x*(0.1424*x - 0.89) + 2.16) - 2.6385) + 2.1456) + 0.0788;
			return Success;
		case 4:
			*output = 0.0815 - x*(x*(x*(0.1495*x - 0.7961) + 1.594) - 1.8662);
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_PadeSin
* @parameter:	[in] 	*input			A pointer to the argument of a Sinusoidal function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Pade approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_PadeSin(double* input, unsigned int order, double* output)
{
	double x,fenmu,fenzi;
	x = *input;
	switch(order){
		case 8:
			fenmu = 1243455.621408+x*x*(32456.9621376+x*x*(432.68148+x*x*(3.6607536+x*x*0.01768969)));
			fenzi = x*(1243455.621408-x*x*(174785.6414304-x*x*(5385.3179688-x*x*44.69552712)));
			*output = fenzi/fenmu;
			return Success;
		case 7:
			fenmu = 1151133.984+x*x*(27792.072+x*x*(317.772+x*x*1.8361));
			fenzi = x*(1151133.984-x*x*(164063.592-x*x*(5278.5432-x*x*47.9249)));
			*output = fenzi/fenmu;
			return Success;
		case 6:
			fenmu = 18328.464+x*x*(672.84+x*x*(12.621+x*x*0.1331));
			fenzi = x*(18328.464-x*x*(2381.904-x*x*53.2182));
			*output = fenzi/fenmu;
			return Success;
		case 5:
			fenmu = 1663.2+x*x*(54.6+x*x*0.75);
			fenzi = x*(1663.2-x*x*(222.6-x*x*5.51));
			*output = fenzi/fenmu;
			return Success;
		case 4:
			fenmu = 5880+x*x*(360+x*x*11);
			fenzi = x*(5880-x*x*620);
			*output = fenzi/fenmu;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_PadeCos
* @parameter:	[in] 	*input			A pointer to the argument of a Cosine function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Pade approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_PadeCos(double* input, unsigned int order, double* output)
{
	double x,fenmu,fenzi;
	x = *input;
	switch(order){
		case 8:
			fenmu = 23594700.7296+x*x*(522334.6128+x*x*(5772.80088+x*x*(39.32892+x*x*0.147173)));
			fenzi = 23594700.7296-x*x*(11275015.752-x*x*(727718.02488-x*x*(13853.547-x*x*80.737373)));
			*output = fenzi/fenmu;
			return Success;
		case 7:
		case 6:
			fenmu = 3925.152+x*x*(115.416+x*x*(1.6632+x*x*0.0127));
			fenzi = 3925.152-x*x*(1847.16-x*x*(107.5032-x*x*1.4615));
			*output = fenzi/fenmu;
			return Success;
		case 5:
		case 4:
			fenmu = 15120+x*x*(660+x*x*13);
			fenzi = 15120-x*x*(6900-x*x*313);
			*output = fenzi/fenmu;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_PadeTan
* @parameter:	[in] 	*input			A pointer to the argument of a Tangent function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Pade approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_PadeTan(double* input, unsigned int order, double* output)
{
	double x,fenmu,fenzi;
	x = *input;
	switch(order){
		case 8:
			fenmu = 20270.25-x*x*(9459.45-x*x*(519.75-x*x*(6.3-x*x)));
			fenzi = x*(20270.25-x*x*(2702.7-x*x*(69.3-x*x*0.36)));
			*output = fenzi/fenmu;
			return Success;
		case 7:
			fenmu = 1351.35-x*x*(623.7-x*x*(31.5-x*x*0.28));
			fenzi = x*(1351.35-x*x*(173.25-x*x*(3.78-x*x)));
			*output = fenzi/fenmu;
			return Success;
		case 6:
			fenmu = 103.95-x*x*(47.25-x*x*(2.1-x*x));
			fenzi = x*(103.95-x*x*(12.6-x*x*0.21));
			*output = fenzi/fenmu;
			return Success;
		case 5:
			fenmu = 94.5-x*x*(42.0-x*x*1.5);
			fenzi = x*(94.5-x*x*(10.5-x*x));
			*output = fenzi/fenmu;
			return Success;
		case 4:
			fenmu = 10.5-x*x*(4.5-x*x*0.1);
			fenzi = x*(10.5-x*x);
			*output = fenzi/fenmu;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_PadeSec
* @parameter:	[in] 	*input			A pointer to the argument of a Secant function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Pade approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_PadeSec(double* input, unsigned int order, double* output)
{
	double x,fenmu,fenzi;
	x = *input;
	switch(order){
		case 8:
			fenmu = 23594700.7296-x*x*(11275015.752-x*x*(727718.02488-x*x*(13853.547-x*x*80.737373)));
			fenzi = 23594700.7296+x*x*(522334.6128+x*x*(5772.80088+x*x*(39.32892+x*x*0.147173)));
			*output = fenzi/fenmu;
			return Success;
		case 7:
		case 6:
			fenmu = 39251.52-x*x*(18471.6-x*x*(1075.032-x*x*14.615));
			fenzi = 39251.52+x*x*(1154.16+x*x*(16.632+x*x*0.127));
			*output = fenzi/fenmu;
			return Success;
		case 5:
		case 4:
			fenmu = 15.12-x*x*(6.9-x*x*0.313);
			fenzi = 15.12+x*x*(0.66-x*x*0.013);
			*output = fenzi/fenmu;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_PadeCsc
* @parameter:	[in] 	*input			A pointer to the argument of a Cosecant function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Pade approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_PadeCsc(double* input, unsigned int order, double* output)
{
	double x,fenmu,fenzi;
	x = *input;
	switch(order){
		case 8:
			fenmu = x*(124345562.1408-x*x*(17478564.14304-x*x*(538531.79688-x*x*4469.552712)));
			fenzi = 124345562.1408+x*x*(3245696.21376+x*x*(43268.148+x*x*(366.07536+x*x*1.768969)));
			*output = fenzi/fenmu;
			return Success;
		case 7:
			fenmu = x*(11511.33984-x*x*(1640.63592-x*x*(52.785432-x*x*0.479249)));
			fenzi = 11511.33984+x*x*(277.92072+x*x*(3.17772+x*x*0.018361));
			*output = fenzi/fenmu;
			return Success;
		case 6:
			fenmu = x*(18328.464-x*x*(2381.904-x*x*53.2182));
			fenzi = 18328.464+x*x*(672.84+x*x*(12.621+x*x*0.1331));
			*output = fenzi/fenmu;
			return Success;
		case 5:
			fenmu = x*(166.320-x*x*(22.260-x*x*0.551));
			fenzi = 166.320+x*x*(5.460+x*x*0.075);
			*output = fenzi/fenmu;
			return Success;
		case 4:
			fenmu = x*(58.8-x*x*6.2);
			fenzi = 58.8+x*x*(3.6+x*x*0.11);
			*output = fenzi/fenmu;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_PadeCot
* @parameter:	[in] 	*input			A pointer to the argument of a Cotangent function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Pade approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_PadeCot(double* input, unsigned int order, double* output)
{
	double x,fenmu,fenzi;
	x = *input;
	switch(order){
		case 8:
			fenmu = x*(2027.025-x*x*(270.27-x*x*(6.93-x*x*0.036)));
			fenzi = 2027.025-x*x*(945.945-x*x*(51.975-x*x*(0.63-x*x*0.001)));
			*output = fenzi/fenmu;
			return Success;
		case 7:
			fenmu = x*(135.135-x*x*(17.325-x*x*(0.378-x*x*0.001)));
			fenzi = 135.135-x*x*(62.37-x*x*(3.15-x*x*0.028));
			*output = fenzi/fenmu;
			return Success;			
		case 6:
			fenmu = x*(103.95-x*x*(12.6-x*x*0.21));
			fenzi = 103.95-x*x*(47.25-x*x*(2.1-x*x*0.01));
			*output = fenzi/fenmu;
			return Success;			
		case 5:
			fenmu = x*(9.45-x*x*(1.05-x*x*0.01));
			fenzi = 9.45-x*x*(4.2-x*x*0.15);
			*output = fenzi/fenmu;
			return Success;		
		case 4:
			fenmu = x*(10.5-x*x);
			fenzi = 10.5-x*x*(4.5-x*x*0.1);
			*output = fenzi/fenmu;
			return Success;		
		default:
			return Error;
	}
}

/* 
* @function: 	My_PadeExp
* @parameter:	[in] 	*input			A pointer to the argument of a Exponential functions.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Pade approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_PadeExp(double* input, unsigned int order, double* output)
{
	double x,fenmu,fenzi;
	x = *input;
	switch(order){
		case 8:
			fenmu = 51891.84-x*(25945.92-x*(6054.048-x*(864.864-x*(83.16-x*(5.544-x*(0.252-x*(0.0072+x*0.0001)))))));
			fenzi = 51891.84+x*(25945.92+x*(6054.048+x*(864.864+x*(83.16+x*(5.544+x*(0.252+x*(0.0072+x*0.0001)))))));
			*output = fenzi/fenmu;
			return Success;
		case 7:
			fenmu = 1729.728-x*(864.864-x*(199.584-x*(27.72-x*(2.52-x*(0.1512-x*(0.0056-x*0.0001))))));
			fenzi = 1729.728+x*(864.864+x*(199.584+x*(27.72+x*(2.52+x*(0.1512+x*(0.0056+x*0.0001))))));
			*output = fenzi/fenmu;
			return Success;
		case 6:
			fenmu = 665.28-x*(33.264-x*(75.6-x*(10.08-x*(0.84-x*(0.042-x*0.001)))));
			fenzi = 665.28+x*(33.264+x*(75.6+x*(10.08+x*(0.84+x*(0.042+x*0.001)))));
			*output = fenzi/fenmu;
			return Success;
		case 5:
			fenmu = 30.24-x*(15.12-x*(3.36-x*(0.42-x*(0.03-x*0.001))));
			fenzi = 30.24+x*(15.12+x*(3.36+x*(0.42+x*(0.03+x*0.001))));
			*output = fenzi/fenmu;
			return Success;
		case 4:
			fenmu = 16.8-x*(8.4-x*(1.8-x*(0.2-x*0.01)));
			fenzi = 16.8+x*(8.4+x*(1.8+x*(0.2+x*0.01)));
			*output = fenzi/fenmu;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_PadeLog
* @parameter:	[in] 	*input			A pointer to the argument of a Logarithmic functions.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Pade approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_PadeLog(double* input, unsigned int order, double* output)
{
	double x,fenmu,fenzi;
	x = *input;
	switch(order){
		case 8:
			fenzi = -761-x*(28544+x*(208544+x*(395136-x*x*(395136+x*(208544+x*(28544+x*761))))));
			fenmu = 140+x*(8960+x*(109760+x*(439040+x*(686000+x*(439040+x*(109760+x*(8960+x*140)))))));
			*output = fenzi/fenmu;
			return Success;
		case 7:
			fenzi = -363-x*(9947+x*(48363+x*(42875-x*(42875+x*(48363+x*(9947+x*363))))));
			fenmu = 70+x*(3430+x*(30870+x*(85750+x*(85750+x*(30870+x*(3430+x*70))))));
			*output = fenzi/fenmu;
			return Success;
		case 6:
			fenzi = -49-x*(924+x*(2625-x*x*(2625+x*(924+x*49))));
			fenmu = 10+x*(360+x*(2250+x*(4000+x*(2250+x*(360+x*10)))));
			*output = fenzi/fenmu;
			return Success;
		case 5:
			fenzi = -137-x*(1625+x*(2000-x*(2000+x*(1625+x*137))));
			fenmu = 30+x*(750+x*(3000+x*(3000+x*(750+x*30))));
			*output = fenzi/fenmu;
			return Success;
		case 4:
			fenzi = -25-x*(160-x*x*(160+x*25));
			fenmu = 30+x*(750+x*(3000+x*(3000+x*(750+x*30))));
			*output = fenzi/fenmu;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_PadeArctan
* @parameter:	[in] 	*input			A pointer to the argument of a Arctangent function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Pade approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_PadeArctan(double* input, unsigned int order, double* output)
{
	double x,fenmu,fenzi;
	x = *input;
	switch(order){
		case 8:
			fenzi = x*(x*x*(x*x*(151.59*x*x+1474.55)+3453.45)+2252.25);
			fenmu = x*x*(x*x*(x*x*(12.25*x*x+441)+2425.5)+4204.2)+2252.25;
			*output = fenzi/fenmu;
			return Success;
		case 7:
			fenzi = x*(x*x*(x*x*(2.56*x*x+59.43)+192.5)+150.15);
			fenmu = x*x*(x*x*(12.25*x*x+110.25)+242.55)+150.15;
			*output = fenzi/fenmu;
			return Success;
		case 6:
			fenzi = x*(x*x*(2.31*x*x+11.9)+11.55);
			fenmu = x*x*(x*x*(0.25*x*x+5.25)+15.75)+11.55;
			*output = fenzi/fenmu;
			return Success;
		case 5:
			fenzi = x*(x*x*(0.64*x*x+7.35)+9.45);
			fenmu = x*x*(2.25*x*x+10.5)+9.45;
			*output = fenzi/fenmu;
			return Success;
		case 4:
			fenzi = x*(5.5*x*x+10.5);
			fenmu = x*x*(0.9*x*x+9)+10.5;
			*output = fenzi/fenmu;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_PadeSqrt
* @parameter:	[in] 	*input			A pointer to the argument of a Square root.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Pade approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_PadeSqrt(double* input, unsigned int order, double* output)
{
	double x,fenmu,fenzi;
	x = *input;
	switch(order){
		case 8:
			fenmu = x*(x*(x*(x*(x*(x*(x*(x + 136) + 2380) + 12376) + 24310) + 19448) + 6188) + 680) + 17;
			fenzi = x*(x*(x*(x*(x*(x*(x*(17*x + 680) + 6188) + 19448) + 24310) + 12376) + 2380) + 136) + 1;
			*output = fenzi/fenmu;
			return Success;
		case 7:
			fenmu = x*(x*(x*(x*(x*(x*(x + 105) + 1365) + 5005) + 6435) + 3003) + 455) + 15;
			fenzi = x*(x*(x*(x*(x*(x*(15*x + 455) + 3003) + 6435) + 5005) + 1365) + 105) + 1;
			*output = fenzi/fenmu;
			return Success;
		case 6:
			fenmu = x*(x*(x*(x*(x*(x + 78) + 715) + 1716) + 1287) + 286) + 13;
			fenzi = x*(x*(x*(x*(x*(13*x + 286) + 1287) + 1716) + 715) + 78) + 1;
			*output = fenzi/fenmu;
			return Success;
		case 5:
			fenmu = x*(x*(x*(x*(x + 55) + 330) + 462) + 165) + 11;
			fenzi = x*(x*(x*(x*(11*x + 165) + 462) + 330) + 55) + 1;
			*output = fenzi/fenmu;
			return Success;
		case 4:
			fenmu = x*(x*(x*(x + 36) + 126) + 84) + 9;
			fenzi = x*(x*(x*(9*x + 84) + 126) + 36) + 1;
			*output = fenzi/fenmu;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_TaylorSin
* @parameter:	[in] 	*input			A pointer to the argument of a Sinusoidal function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Taylor series.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_TaylorSin(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = x*(1.0-x*x*(1.0/6-x*x*(1.0/120-x*x*1.0/5040)));
			return Success;
		case 7:
		case 6:
			*output = x*(1.0-x*x*(1.0/6-x*x*1.0/120));
			return Success;
		case 5:
		case 4:
			*output = x*(1.0-x*x*1.0/6);
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_TaylorCos
* @parameter:	[in] 	*input			A pointer to the argument of a Cosine function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Taylor series.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_TaylorCos(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
		case 7:
			*output = 1-x*x*(1.0/2.0-x*x*(1.0/24.0-x*x*1.0/720.0));
			return Success;
		case 6:
		case 5:
			*output = 1-x*x*(1.0/2.0-x*x*1.0/24.0);
			return Success;
		case 4:
			*output = 1-x*x*1.0/2.0;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_TaylorTan
* @parameter:	[in] 	*input			A pointer to the argument of a Tangent function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Taylor series.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_TaylorTan(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = x*(1.0+x*x*(1.0/3+x*x*(2.0/15+x*x*17.0/315)));
			return Success;
		case 7:
		case 6:
			*output = x*(1.0+x*x*(1.0/3+x*x*2.0/15));
			return Success;
		case 5:
		case 4:
			*output = x*(1.0+x*x*1.0/3);
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_TaylorSec
* @parameter:	[in] 	*input			A pointer to the argument of a Secant function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Taylor series.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_TaylorSec(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = 1+x*x*(1.0/2+x*x*(5.0/24+x*x*61.0/720));
			return Success;
		case 7:
		case 6:
			*output = 1+x*x*(1.0/2+x*x*5.0/24);
			return Success;
		case 5:
		case 4:
			*output = 1+x*x*1.0/2;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_TaylorCsc
* @parameter:	[in] 	*input			A pointer to the argument of a Cosecant function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Taylor series.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_TaylorCsc(double* input, unsigned int order, double* output)
{
	double x;
	x = *input-My_PI/2;
	switch(order){
		case 8:
			*output = 1+x*x*(1.0/2+x*x*(5.0/24+x*x*61.0/720));
			return Success;
		case 7:
		case 6:
			*output = 1+x*x*(1.0/2+x*x*5.0/24);
			return Success;
		case 5:
		case 4:
			*output = 1+x*x*1.0/2;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_TaylorCot
* @parameter:	[in] 	*input			A pointer to the argument of a Cotangent function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Taylor series.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_TaylorCot(double* input, unsigned int order, double* output)
{
	double x;
	x = *input-My_PI/2;
	switch(order){
		case 8:
			*output = -x*(1.0+x*x*(1.0/3+x*x*(2.0/15+x*x*17.0/315)));
			return Success;
		case 7:
		case 6:
			*output = -x*(1.0+x*x*(1.0/3+x*x*2.0/15));
			return Success;
		case 5:
		case 4:
			*output = -x*(1.0+x*x*1.0/3);
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_TaylorExp
* @parameter:	[in] 	*input			A pointer to the argument of a Exponential functions.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Taylor series.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_TaylorExp(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = 1+x*(1.0+x*(1.0/2+x*(1.0/6+x*(1.0/24+x*(1.0/120+x*(1.0/720+x*1.0/5040))))));
			return Success;
		case 7:
			*output = 1+x*(1.0+x*(1.0/2+x*(1.0/6+x*(1.0/24+x*(1.0/120+x*1.0/720)))));
			return Success;
		case 6:
			*output = 1+x*(1.0+x*(1.0/2+x*(1.0/6+x*(1.0/24+x*1.0/120))));
			return Success;
		case 5:
			*output = 1+x*(1.0+x*(1.0/2+x*(1.0/6+x*1.0/24)));
			return Success;
		case 4:
			*output = 1+x*(1.0+x*(1.0/2+x*1.0/6));
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_TaylorLog
* @parameter:	[in] 	*input			A pointer to the argument of a Logarithmic functions.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Taylor series.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_TaylorLog(double* input, unsigned int order, double* output)
{
	double x;
	x = *input-1;
	switch(order){
		case 8:
			*output = x*(1.0-x*(1.0/2-x*(1.0/3-x*(1.0/4-x*(1.0/5-x*(1.0/6-x/7.0))))));
			return Success;
		case 7:
			*output = x*(1.0-x*(1.0/2-x*(1.0/3-x*(1.0/4-x*(1.0/5-x*1.0/6)))));
			return Success;			
		case 6:
			*output = x*(1.0-x*(1.0/2-x*(1.0/3-x*(1.0/4-x*1.0/5))));
			return Success;
		case 5:
			*output = x*(1.0-x*(1.0/2-x*(1.0/3-x*1.0/4)));
			return Success;
		case 4:
			*output = x*(1.0-x*(1.0/2-x*1.0/3));
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_TaylorArctan
* @parameter:	[in] 	*input			A pointer to the argument of a Arctangent function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Taylor series.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_TaylorArctan(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
		case 7:
			*output = x*(1.0-x*x*(1.0/3-x*x*(1.0/5-x*x*1.0/7)));
			return Success;			
		case 6:
		case 5:
			*output = x*(1.0-x*x*(1.0/3-x*x*1.0/5));
			return Success;
		case 4:
			*output = x*(1.0-x*x*1.0/3);
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_TaylorSqrt
* @parameter:	[in] 	*input			A pointer to the argument of a Square root.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Taylor series.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_TaylorSqrt(double* input, unsigned int order, double* output)
{
	double x;
	x = *input-1;
	switch(order){
		case 8:
			*output = x*(x*(x*(x*(x*(x*(0.01611*x - 0.02051) + 0.02734) - 0.03906) + 0.0625) - 0.125) + 0.5) + 1.0;
			return Success;
		case 7:
			*output = 1.0 - x*(x*(x*(x*(x*(0.02051*x - 0.02734) + 0.03906) - 0.0625) + 0.125) - 0.5);
			return Success;			
		case 6:
			*output = x*(x*(x*(x*(0.02734*x - 0.03906) + 0.0625) - 0.125) + 0.5) + 1.0;
			return Success;
		case 5:
			*output = 1.0 - x*(x*(x*(0.03906*x - 0.0625) + 0.125) - 0.5);
			return Success;
		case 4:
			*output = x*(x*(0.0625*x - 0.125) + 0.5) + 1.0;
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_BernoulliSin
* @parameter:	[in] 	*input			A pointer to the argument of a Sinusoidal function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Bernoulli split-part approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_BernoulliSin(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:	
			*output = x+1/((-6.0/(x*x*x))+1/((-10*x/3)+1/((12.6/(1.1*x*x*x))+1/((24.2*x/2.5)+1/((-112.5/(13.31*x*x*x))
								+1/((-(46060.586*x)/1377.075)+1/((1011378.963/(235449.7739*x*x*x))+1/((479.249*x)/18.361))))))));
			return Success;
		case 7:
			*output = x+1/((-6.0/(x*x*x))+1/((-10*x/3)+1/((12.6/(1.1*x*x*x))+1/((24.2*x/2.5)
								+1/((-112.5/(13.31*x*x*x))+1/((-(46060.586*x)/1377.075)+1/((1011378.963/(235449.7739*x*x*x)))))))));
			return Success;
		case 6:
			*output = x+1/((-6.0/(x*x*x))+1/((-10*x/3)+1/((12.6/(1.1*x*x*x))+1/((24.2*x/2.5)
								+1/((-112.5/(13.31*x*x*x))+1/((-(46060.586*x)/1377.075)))))));
			return Success;
		case 5:
			*output = x+1/((-6.0/(x*x*x))+1/((-10*x/3)+1/((12.6/(1.1*x*x*x))+1/((24.2*x/2.5)+1/((-112.5/(13.31*x*x*x)))))));
			return Success;
		case 4:
			*output = x+1/((-6.0/(x*x*x))+1/((-10*x/3)+1/((12.6/(1.1*x*x*x))+1/((24.2*x/2.5)))));
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_BernoulliCos
* @parameter:	[in] 	*input			A pointer to the argument of a Cosine function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Bernoulli split-part approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_BernoulliCos(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = 1+1/((-2/(x*x))+1/(-6.0+1/((10/(3*x*x))+1/(37.8/1.3+1/((-3.38/(1.77*x*x))
								+1/((-229.746/1.651)+1/((209.677/(268.2671*x*x))+1/(186.90971/124045.79766))))))));
			return Success;
		case 7:
		case 6:
			*output = 1+1/((-2/(x*x))+1/(-6.0+1/((10/(3*x*x))+1/(37.8/1.3+1/((-3.38/(1.77*x*x))+1/(-229.746/1.651))))));
			return Success;
		case 5:
		case 4:
			*output = 1+1/((-2/(x*x))+1/(-6+1/((10/(3*x*x))+1/(37.8/1.3))));
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_BernoulliTan
* @parameter:	[in] 	*input			A pointer to the argument of a Tangent function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Bernoulli split-part approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_BernoulliTan(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = x+1/((3/(x*x*x))+1/((-5*x/6)+1/((252/(x*x*x))+1/((-x/10)+1/((2475/(x*x*x))
								+1/((-(1.3*x)/42)+1/((11760/(x*x*x))+1/(-x/28))))))));
			return Success;
		case 7:
			*output = x+1/((3/(x*x*x))+1/((-5*x/6)+1/((252/(x*x*x))+1/((-x/10)
								+1/((2475/(x*x*x))+1/((-(1.3*x)/42)+1/((11760/(x*x*x)))))))));
			return Success;
		case 6:
			*output = x+1/((3/(x*x*x))+1/((-5*x/6)+1/((252/(x*x*x))
								+1/((-x/10)+1/((2475/(x*x*x))+1/((-(1.3*x)/42)))))));
			return Success;
		case 5:
			*output = x+1/((3/(x*x*x))+1/((-5*x/6)+1/((252/(x*x*x))+1/((-x/10)+1/((2475/(x*x*x)))))));
			return Success;
		case 4:
			*output = x+1/((3/(x*x*x))+1/((-5*x/6)+1/((252/(x*x*x))+1/((-x/10)))));
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_BernoulliSec
* @parameter:	[in] 	*input			A pointer to the argument of a Secant function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Bernoulli split-part approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_BernoulliSec(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = 1+1/(2/(x*x)+1/(-6.0/5+1/((-25/(0.3*x*x))+1/(3.78/15.65+1/(1959.38/(1.77*x*x)
								+1/(-229.746/4574.495+1/(-277677.6925/(26.82671*x*x)+1/(11799767.06395/124045.79766))))))));				
			return Success;
		case 7:
		case 6:
			*output = 1+1/(2/(x*x)+1/(-6.0/5+1/((-25/(0.3*x*x))+1/(37.8/156.5
								+1/(195.938/(0.177*x*x)+1/(-229.746/4574.495))))));
			return Success;
		case 5:
		case 4:
			*output = 1+1/(2/(x*x)+1/(-6.0/5+1/((-25/(0.3*x*x))+1/(37.8/156.5))));
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_BernoulliCsc
* @parameter:	[in] 	*input			A pointer to the argument of a Cosecant function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Bernoulli split-part approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_BernoulliCsc(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = 1/x+1/(6/x+1/(-10/(7*x)+1/(-68.6/(1.1*x)+1/(21.78/(38.57*x)+1/(607.202/(1.331*x)
								+1/(-460.60586/(2640.66199*x)+1/(-6890388.12003/(2354.497739*x))))))));
			return Success;
		case 7:
			*output = 1/x+1/(6/x+1/(-10/(7*x)+1/(-68.6/(1.1*x)+1/(2.178/(3.857*x)
								+1/(607.202/(1.331*x)+1/(-4606.0586/(26406.6199*x)))))));
			return Success;
		case 6:
			*output = 1/x+1/(6/x+1/(-10/(7*x)+1/(-68.6/(1.1*x)
								+1/(21.78/(38.57*x)+1/(607.202/(1.331*x))))));
			return Success;
		case 5:
			*output = 1/x+1/(6/x+1/(-1/(0.7*x)+1/(-68.6/(1.1*x)+1/(21.78/(38.57*x)))));
			return Success;
		case 4:
			*output = 1/x+1/(6/x+1/(-1/(0.7*x)+1/(-68.6/(1.1*x))));
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_BernoulliCot
* @parameter:	[in] 	*input			A pointer to the argument of a Cotangent function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Bernoulli split-part approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_BernoulliCot(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = 1/x+1/(-3/x+1/(5/x+1/(-7/x+1/(9/x+1/(-11/x+1/(13/x+1/(-15/x)))))));
			return Success;
		case 7:
			*output = 1/x+1/(-3/x+1/(5/x+1/(-7/x+1/(9/x+1/(-11/x+1/(13/x))))));
			return Success;			
		case 6:
			*output = 1/x+1/(-3/x+1/(5/x+1/(-7/x+1/(9/x+1/(-11/x)))));
			return Success;			
		case 5:
			*output = 1/x+1/(-3/x+1/(5/x+1/(-7/x+1/(9/x))));
			return Success;		
		case 4:
			*output = 1/x+1/(-3/x+1/(5/x+1/(-7/x)));
			return Success;		
		default:
			return Error;
	}
}

/* 
* @function: 	My_BernoulliExp
* @parameter:	[in] 	*input			A pointer to the argument of a Exponential functions.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Bernoulli split-part approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_BernoulliExp(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = 1+1/(1/x+1/(-2.0+1/(-3/x+1/(2.0+1/(5/x+1/(-2.0+1/(-7/x+1/(2.0+1/(9/x
								+1/(-2.0+1/(-11/x+1/(2.0+1/(13/x+1/(-2.0+1/(-15/x+1/(2.0))))))))))))))));
			return Success;
		case 7:
			*output = 1+1/(1/x+1/(-2.0+1/(-3/x+1/(2.0+1/(5/x+1/(-2.0+1/(-7/x+1/(2.0+1/(9/x+1/(-2.0
								+1/(-11/x+1/(2.0+1/(13/x+1/(-2.0))))))))))))));
			return Success;
		case 6:
			*output = 1+1/(1/x+1/(-2.0+1/(-3/x+1/(2.0+1/(5/x+1/(-2.0+1/(-7/x+1/(2.0+1/(9/x
								+1/(-2.0+1/(-11/x+1/(2.0))))))))))));
			return Success;
		case 5:
			*output = 1+1/(1/x+1/(-2.0+1/(-3/x+1/(2.0+1/(5/x+1/(-2.0+1/(-7/x+1/(2.0+1/(9/x+1/(-2.0))))))))));
			return Success;
		case 4:
			*output = 1+1/(1/x+1/(-2.0+1/(-3/x+1/(2.0+1/(5/x+1/(-2.0+1/(-7/x+1/(2.0))))))));
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_BernoulliLog
* @parameter:	[in] 	*input			A pointer to the argument of a Logarithmic functions.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Bernoulli split-part approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_BernoulliLog(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = 0+1/(1/(x-1)+1/(2.0+1/(3/(x-1)+1/(1.0+1/(5/(x-1)+1/(2.0/3+1/(7/(x-1)+1/(0.5+1/(9/(x-1)
								+1/(0.4+1/(11/(x-1)+1/(1.0/3+1/(13/(x-1)+1/(2.0/7+1/(1/(x-1))))))))))))))));
								
			return Success;
		case 7:
			*output = 0+1/(1/(x-1)+1/(2.0+1/(3/(x-1)+1/(1.0+1/(5/(x-1)+1/(2.0/3+1/(7/(x-1)+1/(0.5
								+1/(9/(x-1)+1/(0.4+1/(11/(x-1)+1/(1.0/3+1/(1/(x-1))))))))))))));
			return Success;
		case 6:
			*output = 0+1/(1/(x-1)+1/(2.0+1/(3/(x-1)+1/(1.0+1/(5/(x-1)+1/(2.0/3
								+1/(7/(x-1)+1/(0.5+1/(9/(x-1)+1/(0.4+1/(1/(x-1))))))))))));
			return Success;
		case 5:
			*output = 0+1/(1/(x-1)+1/(2.0+1/(3/(x-1)+1/(1.0+1/(5/(x-1)+1/(2.0/3
								+1/(7/(x-1)+1/(0.5+1/(1/(x-1))))))))));
			return Success;
		case 4:
			*output = 0+1/(1/(x-1)+1/(2.0+1/(3/(x-1)+1/(1.0+1/(5/(x-1)+1/(2.0/3+1/(7/(x-1))))))));
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_BernoulliArctan
* @parameter:	[in] 	*input			A pointer to the argument of a Arctangent function.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Bernoulli split-part approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_BernoulliArctan(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = x+1/((-3/(x*x*x))+1/((-5*x/9)+1/((-63/(4*x*x*x))+1/((-(4*x)/25)+1/((-24.75/(0.64*x*x*x))
								+1/((-(8.32*x)/110.25)+1/((-183.75/(2.56*x*x*x))+1/(-(2.56*x)/12.25))))))));
			return Success;
		case 7:
			*output = x+1/((-3/(x*x*x))+1/((-5*x/9)+1/((-63/(4*x*x*x))+1/((-(4*x)/25)
								+1/((-24.75/(0.64*x*x*x))+1/((-(8.32*x)/110.25)+1/((-183.75/(2.56*x*x*x)))))))));
			return Success;
		case 6:
			*output = x+1/((-3/(x*x*x))+1/((-5*x/9)+1/((-63/(4*x*x*x))
								+1/((-(4*x)/25)+1/((-24.75/(0.64*x*x*x))+1/((-(8.32*x)/110.25)))))));
			return Success;
		case 5:
			*output = x+1/((-3/(x*x*x))+1/((-5*x/9)+1/((-63/(4*x*x*x))+1/((-(4*x)/25)+1/((-24.75/(0.64*x*x*x)))))));
			return Success;
		case 4:
			*output = x+1/((-3/(x*x*x))+1/((-5*x/9)+1/((-63/(4*x*x*x))+1/((-(4*x)/25)))));
			return Success;
		default:
			return Error;
	}
}

/* 
* @function: 	My_BernoulliSqrt
* @parameter:	[in] 	*input			A pointer to the argument of a Square root.
* @parameter:	[in] 	order			The order of the function approximation.
*										This parameter can be any integer from 4 to 8.
* @parameter:	[out]	*output			The result of the calculation based on the Bernoulli split-part approximation.
* @return:		Successes or failures of the results of the calculations.
*/
static ResStatus_TypeDef My_BernoulliSqrt(double* input, unsigned int order, double* output)
{
	double x;
	x = *input;
	switch(order){
		case 8:
			*output = 0.1/1.7+1/(1.7/(9.6*x)+1/(9.6/32.3+1/(3.23/(7.68*x)+1/(23.04/41.99
								+1/(41.99/(61.44*x)+1/(61.44/74.29+1/(96.577/(98.304*x)+1/(32.768/28.405+1/(705.755/(524.288*x)
								+1/(524.288/334.305+1/(768.9015/(419.4304*x)+1/(419.4304/193.8969+1/(8725.3605/(3355.4432*x)
								+1/(3355.4432/1036.3455+1/(93167.46045/(21474.83648*x)+1/(21474.83648/3005.40195))))))))))))))));
			return Success;
		case 7:
			*output = 1/17+1/(1.7/(9.6*x)+1/(9.6/32.3+1/(3.23/(7.68*x)+1/(23.04/41.99+1/(41.99/(61.44*x)
								+1/(61.44/74.29+1/(96.577/(98.304*x)+1/(32.768/28.405+1/(705.755/(524.288*x)
								+1/(524.288/334.305+1/(768.9015/(419.4304*x)+1/(419.4304/193.8969
								+1/(8725.3605/(3355.4432*x)+1/(3355.4432/1036.3455))))))))))))));
			return Success;			
		case 6:
			*output = 1/17+1/(1.7/(9.6*x)+1/(9.6/32.3+1/(3.23/(7.68*x)+1/(23.04/41.99+1/(41.99/(61.44*x)
								+1/(61.44/74.29+1/(96.577/(98.304*x)+1/(32.768/28.405+1/(705.755/(524.288*x)
								+1/(524.288/334.305+1/(768.9015/(419.4304*x)+1/(419.4304/193.8969))))))))))));		
			return Success;
		case 5:
			*output = 1/17+1/(1.7/(9.6*x)+1/(9.6/32.3+1/(3.23/(7.68*x)+1/(23.04/41.99+1/(41.99/(61.44*x)+1/(61.44/74.29
								+1/(96.577/(98.304*x)+1/(32.768/28.405+1/(705.755/(524.288*x)+1/(524.288/334.305))))))))));						
			return Success;
		case 4:
			*output = 1/17+1/(1.7/(9.6*x)+1/(9.6/32.3+1/(3.23/(7.68*x)+1/(23.04/41.99+1/(41.99/(61.44*x)
								+1/(61.44/74.29+1/(96.577/(98.304*x)+1/(32.768/28.405))))))));						
			return Success;
		default:
			return Error;
	}
}

/* 
* @function:    My_RealSin
* @parameter:   [in]    Mothod          The approximation method used for the calculation.
*                                       This parameter can be any value of @ref ResMothod_TypeDef.
* @parameter:   [in]    *input          A pointer to the argument of a Sinusoidal function.
*                                       This parameter can be selected in its definition domain.
* @parameter:   [in]    order           The order of the function approximation.
*                                       This parameter can be any integer from 4 to 8.
* @parameter:   [out]   *output         The result of the calculation your mothod.
* @return:      Successes or failures of the results of the calculations.
*/
ResStatus_TypeDef My_RealSin(ResMothod_TypeDef Mothod, double* input, unsigned int order, double* output)
{	
	if((*input>My_PI)||(*input<-My_PI)){
		*input -= ((int)(*input/(2*My_PI)))*2*My_PI;
		if((*input)>My_PI)	
			*input -= 2*My_PI;
		if((*input)<-My_PI)	
			*input += 2*My_PI;
	}
	if((*input<-My_PI/2)&&(*input>-My_PI))
		*input = -My_PI-(*input);   
	if((*input>My_PI/2)&&(*input<My_PI))
		*input = My_PI-(*input);								
	switch(Mothod){
		case Lagrange:
			return My_LagrangeSin(input,order,output);
		case Pade:
			return My_PadeSin(input,order,output);	
		case Taylor:
			return My_TaylorSin(input,order,output);
		case Bernoulli:
			return My_BernoulliSin(input,order,output);
		default:
			return Error;
	}
}

/* 
* @function:    My_RealCos
* @parameter:   [in]    Mothod          The approximation method used for the calculation.
*                                       This parameter can be any value of @ref ResMothod_TypeDef.
* @parameter:   [in]    *input          A pointer to the argument of a Cosine function.
*                                       This parameter can be selected in its definition domain.
* @parameter:   [in]    order           The order of the function approximation.
*                                       This parameter can be any integer from 4 to 8.
* @parameter:   [out]   *output         The result of the calculation your mothod.
* @return:      Successes or failures of the results of the calculations.
*/
ResStatus_TypeDef My_RealCos(ResMothod_TypeDef Mothod, double* input, unsigned int order, double* output)
{	
	double flag;
	ResStatus_TypeDef state;
	flag = 1;
	if((*input>My_PI)||(*input<-My_PI)){
		*input -= ((int)(*input/(2*My_PI)))*2*My_PI;
		if((*input)>My_PI)	
			*input -= 2*My_PI;
		if((*input)<-My_PI)	
			*input += 2*My_PI;
	}
	if((*input<-My_PI/2)&&(*input>-My_PI)){
		*input = My_PI+(*input);
		flag = -1;
	}
	if((*input>My_PI/2)&&(*input<My_PI)){
		*input = (*input)-My_PI;
		flag = -1;
	}
	switch(Mothod){
		case Lagrange:
			state = My_LagrangeCos(input,order,output);
			*output = flag*(*output);
			return state;
		case Pade:
			state = My_PadeCos(input,order,output);	
			*output = flag*(*output);
			return state;
		case Taylor:
			state = My_TaylorCos(input,order,output);
			*output = flag*(*output);
			return state;
		case Bernoulli:
			state = My_BernoulliCos(input,order,output);
			*output = flag*(*output);
			return state;
		default:
			return Error;
	}
}

/* 
* @function:    My_RealTan
* @parameter:   [in]    Mothod          The approximation method used for the calculation.
*                                       This parameter can be any value of @ref ResMothod_TypeDef.
* @parameter:   [in]    *input          A pointer to the argument of a Tangent function.
*                                       This parameter can be selected in its definition domain.
* @parameter:   [in]    order           The order of the function approximation.
*                                       This parameter can be any integer from 4 to 8.
* @parameter:   [out]   *output         The result of the calculation your mothod.
* @return:      Successes or failures of the results of the calculations.
*/
ResStatus_TypeDef My_RealTan(ResMothod_TypeDef Mothod, double* input, unsigned int order, double* output)
{	
	if( (((*input+My_PI/2)-((int)((*input+My_PI/2)/My_PI))*My_PI)< My_ERROR)
		&&(((*input+My_PI/2)-((int)((*input+My_PI/2)/My_PI))*My_PI)>-My_ERROR) )
		return Error;
	if((*input>My_PI)||(*input<-My_PI)){
		*input -= ((int)(*input/(2*My_PI)))*2*My_PI;
		if((*input)>My_PI)	
			*input -= 2*My_PI;
		if((*input)<-My_PI)	
			*input += 2*My_PI;
	}
	if((*input<-My_PI/2)&&(*input>-My_PI))
		*input += My_PI;
	if((*input>My_PI/2)&&(*input<My_PI))
		*input -= My_PI;
	switch(Mothod){
		case Lagrange:
			return My_LagrangeTan(input,order,output);
		case Pade:
			return My_PadeTan(input,order,output);	
		case Taylor:
			return My_TaylorTan(input,order,output);
		case Bernoulli:
			return My_BernoulliTan(input,order,output);
		default:
			return Error;
	}
}

/* 
* @function:    My_RealSec
* @parameter:   [in]    Mothod          The approximation method used for the calculation.
*                                       This parameter can be any value of @ref ResMothod_TypeDef.
* @parameter:   [in]    *input          A pointer to the argument of a Secant function.
*                                       This parameter can be selected in its definition domain.
* @parameter:   [in]    order           The order of the function approximation.
*                                       This parameter can be any integer from 4 to 8.
* @parameter:   [out]   *output         The result of the calculation your mothod.
* @return:      Successes or failures of the results of the calculations.
*/
ResStatus_TypeDef My_RealSec(ResMothod_TypeDef Mothod, double* input, unsigned int order, double* output)
{	
	
	double flag;
	ResStatus_TypeDef state;
	flag = 1;
	if( (((*input+My_PI/2)-((int)((*input+My_PI/2)/My_PI))*My_PI)< My_ERROR)
		&&(((*input+My_PI/2)-((int)((*input+My_PI/2)/My_PI))*My_PI)>-My_ERROR) )
		return Error;
	if((*input>My_PI)||(*input<-My_PI)){
		*input -= ((int)(*input/(2*My_PI)))*2*My_PI;
		if((*input)>My_PI)	
			*input -= 2*My_PI;
		if((*input)<-My_PI)	
			*input += 2*My_PI;
	}
	if((*input>My_PI/2)&&(*input<My_PI)){
		flag = -1;
		*input -= My_PI;
	}		
	if((*input<-My_PI/2)&&(*input>-My_PI)){
		flag = -1;
		*input += My_PI;
	}
	switch(Mothod){
		case Lagrange:
			state = My_LagrangeSec(input,order,output);
			*output = flag*(*output);
			return state;
		case Pade:
			state = My_PadeSec(input,order,output);
			*output = flag*(*output);
			return state;
		case Taylor:
			state = My_TaylorSec(input,order,output);
			*output = flag*(*output);
			return state;
		case Bernoulli:
			state = My_BernoulliSec(input,order,output);
			*output = flag*(*output);
			return state;
		default:
			return Error;
	}
}

/* 
* @function:    My_RealCsc
* @parameter:   [in]    Mothod          The approximation method used for the calculation.
*                                       This parameter can be any value of @ref ResMothod_TypeDef.
* @parameter:   [in]    *input          A pointer to the argument of a Cosecant function.
*                                       This parameter can be selected in its definition domain.
* @parameter:   [in]    order           The order of the function approximation.
*                                       This parameter can be any integer from 4 to 8.
* @parameter:   [out]   *output         The result of the calculation your mothod.
* @return:      Successes or failures of the results of the calculations.
*/
ResStatus_TypeDef My_RealCsc(ResMothod_TypeDef Mothod, double* input, unsigned int order, double* output)
{	
	
	double flag;
	ResStatus_TypeDef state;
	flag = 1;
	if( ((*input-((int)(*input/My_PI))*My_PI)< My_ERROR)
		&&((*input-((int)(*input/My_PI))*My_PI)>-My_ERROR) )
		return Error;
	if((*input>My_PI)||(*input<-My_PI)){
		*input -= ((int)(*input/(2*My_PI)))*2*My_PI;
		if((*input)>My_PI)	
			*input -= 2*My_PI;
		if((*input)<-My_PI)	
			*input += 2*My_PI;
	}
	if( (*input>-My_PI) && (*input<0) ){
		flag = -1;
		*input += My_PI;
	}
	if( (*input>My_PI/2) )
		*input = My_PI - *input;
	switch(Mothod){
		case Lagrange:
			state = My_LagrangeCsc(input,order,output);
			*output = flag*(*output);
			return state;
		case Pade:
			state = My_PadeCsc(input,order,output);
			*output = flag*(*output);
			return state;
		case Taylor:
			state = My_TaylorCsc(input,order,output);
			*output = flag*(*output);
			return state;
		case Bernoulli:
			state = My_BernoulliCsc(input,order,output);
			*output = flag*(*output);
			return state;
		default:
			return Error;
	}
}

/* 
* @function:    My_RealCot
* @parameter:   [in]    Mothod          The approximation method used for the calculation.
*                                       This parameter can be any value of @ref ResMothod_TypeDef.
* @parameter:   [in]    *input          A pointer to the argument of a Cotangent function.
*                                       This parameter can be selected in its definition domain.
* @parameter:   [in]    order           The order of the function approximation.
*                                       This parameter can be any integer from 4 to 8.
* @parameter:   [out]   *output         The result of the calculation your mothod.
* @return:      Successes or failures of the results of the calculations.
*/
ResStatus_TypeDef My_RealCot(ResMothod_TypeDef Mothod, double* input, unsigned int order, double* output)
{	
	if( ((*input-((int)(*input/My_PI))*My_PI)< My_ERROR)
		&&((*input-((int)(*input/My_PI))*My_PI)>-My_ERROR) )
		return Error;
	if((*input>My_PI)||(*input<-My_PI)){
		*input -= ((int)(*input/(2*My_PI)))*2*My_PI;
		if((*input)>My_PI)	
			*input -= 2*My_PI;
		if((*input)<-My_PI)	
			*input += 2*My_PI;
	}
	if( (*input>-My_PI) && (*input<0) )
		*input += My_PI;
	switch(Mothod){
		case Lagrange:
			return My_LagrangeCot(input,order,output);
		case Pade:
			return My_PadeCot(input,order,output);	
		case Taylor:
			return My_TaylorCot(input,order,output);
		case Bernoulli:
			return My_BernoulliCot(input,order,output);			
		default:
			return Error;
	}
}

/* 
* @function:    My_RealExp
* @parameter:   [in]    Mothod          The approximation method used for the calculation.
*                                       This parameter can be any value of @ref ResMothod_TypeDef.
* @parameter:   [in]    *input          A pointer to the argument of a Exponential functions.
*                                       This parameter can be selected from -20 to 20.
* @parameter:   [in]    order           The order of the function approximation.
*                                       This parameter can be any integer from 4 to 8.
* @parameter:   [out]   *output         The result of the calculation your mothod.
* @return:      Successes or failures of the results of the calculations.
*/
ResStatus_TypeDef My_RealExp(ResMothod_TypeDef Mothod, double* input, unsigned int order, double* output)
{	
	double mi;
	ResStatus_TypeDef state;
	mi = 1;
	if((*input>20)||(*input<-20))
			return Error;
	if(*input>2){
		while(*input>5){
			*input -= 5;
			mi *= My_EXP_5;
		}
		while(*input>2){
			*input -= 2;
			mi *= My_EXP_2;
		}		
	}
	if(*input<-2){
		while(*input<-5){
			*input += 5;
			mi /= My_EXP_5;
		}
		while(*input<-2){
			*input += 2;
			mi /= My_EXP_2;
		}		
	}
	switch(Mothod){
		case Lagrange:
			state = My_LagrangeExp(input,order,output);
			*output = (*output)*mi;
			return state;
		case Pade:
			state = My_PadeExp(input,order,output);	
			*output = (*output)*mi;
			return state;
		case Taylor:
			state = My_TaylorExp(input,order,output);
			*output = (*output)*mi;
			return state;
		case Bernoulli:
			state = My_BernoulliExp(input,order,output);
			*output = (*output)*mi;
			return state;
		default:
			return Error;
	}
}

/* 
* @function:    My_RealLog
* @parameter:   [in]    Mothod          The approximation method used for the calculation.
*                                       This parameter can be any value of @ref ResMothod_TypeDef.
* @parameter:   [in]    *input          A pointer to the argument of a Logarithmic functions.
*                                       This parameter can be selected in its definition domain.
* @parameter:   [in]    order           The order of the function approximation.
*                                       This parameter can be any integer from 4 to 8.
* @parameter:   [out]   *output         The result of the calculation your mothod.
* @return:      Successes or failures of the results of the calculations.
*/
ResStatus_TypeDef My_RealLog(ResMothod_TypeDef Mothod, double* input, unsigned int order, double* output)
{	
	double mi;
	ResStatus_TypeDef state;
	mi = 0;
	if(*input<=0)
			return Error;
	if(*input<0.5){
		while(*input<0.1){
			*input *= 10;
			mi -= My_LOG_10;
		}
		while(*input<0.5){
			*input *= 2;
			mi -= My_LOG_2;
		}
	}
	if(*input>2){
		while(*input>10){
			*input /= 10;
			mi += My_LOG_10;
		}
		while(*input>2){
			*input /= 2;
			mi += My_LOG_2;
		}
	}							
	switch(Mothod){
		case Lagrange:
			state = My_LagrangeLog(input,order,output);
			*output = (*output)+mi;
			return state;
		case Pade:
			state = My_PadeLog(input,order,output);	
			*output = (*output)+mi;
			return state;
		case Taylor:
			state = My_TaylorLog(input,order,output);
			*output = (*output)+mi;
			return state;
		case Bernoulli:
			state = My_BernoulliLog(input,order,output);
			*output = (*output)+mi;
			return state;
		default:
			return Error;
	}
}

/* 
* @function:    My_RealArctan
* @parameter:   [in]    Mothod          The approximation method used for the calculation.
*                                       This parameter can be any value of @ref ResMothod_TypeDef.
* @parameter:   [in]    *input          A pointer to the argument of a Arctangent function.
*                                       This parameter can be selected in its definition domain.
* @parameter:   [in]    order           The order of the function approximation.
*                                       This parameter can be any integer from 4 to 8.
* @parameter:   [out]   *output         The result of the calculation your mothod.
* @return:      Successes or failures of the results of the calculations.
*/
ResStatus_TypeDef My_RealArctan(ResMothod_TypeDef Mothod, double* input, unsigned int order, double* output)
{	
	double mi;
	ResStatus_TypeDef state;
	char mood;
	mi = *input;
	if(mi<-1){
		*input = -1/mi;  
		mood=0;
	}
	else if(mi<0){
		*input = -mi;
		mood=1;
	}
	else if(mi<=1){
		*input = mi;
		mood=2;
	}
	else{
		*input = 1/mi;
		mood=3;
	}
	switch(Mothod){
		case Lagrange:
			state = My_LagrangeArctan(input,order,output);
			break;
		case Pade:
			state = My_PadeArctan(input,order,output);	
			break;
		case Taylor:
			state = My_TaylorArctan(input,order,output);
			break;
		case Bernoulli:
			state = My_BernoulliArctan(input,order,output);
			break;
		default:
			return Error;
	}
	switch(mood){
		case 3:
			*output = My_PI/2-(*output);
			return state;
		case 2:
			return state;
		case 1:
			*output = -(*output);
			return state;
		case 0:
			*output = -(My_PI/2-(*output));
			return state;
		default:
			return Error;
	}
}

/* 
* @function:    My_RealSqrt
* @parameter:   [in]    Mothod          The approximation method used for the calculation.
*                                       This parameter can be any value of @ref ResMothod_TypeDef.
* @parameter:   [in]    *input          A pointer to the argument of a Square root.
*                                       This parameter can be selected in its definition domain.
* @parameter:   [in]    order           The order of the function approximation.
*                                       This parameter can be any integer from 4 to 8.
* @parameter:   [out]   *output         The result of the calculation your mothod.
* @return:      Successes or failures of the results of the calculations.
*/
ResStatus_TypeDef My_RealSqrt(ResMothod_TypeDef Mothod, double* input, unsigned int order, double* output)
{	
	double mi;
	ResStatus_TypeDef state;
	mi = 1;
	if( *input<0 )
		return Error;
	if( *input==0 )
	{
		*output = 0;
		return Success;
	}
	if(*input<0.5){
		while(*input<0.1){
			*input *= 10;
			mi *= 0.316228;
		}
		while(*input<0.5){
			*input *= 2;
			mi *= 0.707107;
		}
	}
	if(*input>2){
		while(*input>10){
			*input /= 10;
			mi *= 3.162278;
		}
		while(*input>2){
			*input /= 2;
			mi *= 1.41421;
		}
	}	
	switch(Mothod){
		case Lagrange:
			state = My_LagrangeSqrt(input,order,output);
			*output *= mi;
			return state;
		case Pade:
			state = My_PadeSqrt(input,order,output);	
			*output *= mi;
			return state;
		case Taylor:
			state = My_TaylorSqrt(input,order,output);
			*output *= mi;
			return state;
		case Bernoulli:
			state = My_BernoulliSqrt(input,order,output);
			*output *= mi;
			return state;
		default:
			return Error;
	}
}

/* 
* @function:    My_RealAbs
* @parameter:   [in]    *input          A pointer to the argument of a absolute.
*                                       This parameter can be selected in its definition domain.
* @parameter:   [out]   *output         The result of the function.
* @return:      Successes or failures of the results of the calculations.
*/
ResStatus_TypeDef My_RealAbs(double* input, double* output)
{
	if(*input>=0)
		*output = *input;
	else
		*output = -(*input);
	return Success;
}

